package bishizhuanyong.网易;


import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        //数组长度
        int n = scanner.nextInt();
        //操作次数
        int k = scanner.nextInt();
        //减去的数
        int x = scanner.nextInt();
        int[] nums=new int[n];
        for (int i=0;i<nums.length;i++)
            nums[i]=scanner.nextInt();
       for (int i=0,j=nums.length-1;i<j;i++,j--){
           int tmp=nums[i];
           nums[i]=nums[j];
           nums[j]=tmp;
       }
       if (nums.length==1){
           System.out.println(nums[0]-k*x);
           return;
       }
        while (k>0){
            int maxVal=nums[0];
            int gap=0;
            int next =nums[1];
            int cha=maxVal-next;
            if (cha==0){
                gap=1;
            }else {
                if (cha % x == 0) {
                    int zz = cha / x;
                    if (k >= zz)
                        gap = zz;
                    else
                        gap = k;
                } else {
                    int zz = cha / x + 1;
                    if (k >= zz)
                        gap = zz;
                    else
                        gap = k;
                }
            }
            nums[0]-=gap*x;

            k-=gap;
        }
    }
}

/*
public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        //数组长度
        int n = scanner.nextInt();
        //操作次数
        int k = scanner.nextInt();
        //减去的数
        int x = scanner.nextInt();
        PriorityQueue<Integer> priorityQueue=new PriorityQueue<>((a,b)->{
            return b-a;
        });
        for (int i=0;i<n;i++){
            priorityQueue.add(scanner.nextInt());
        }
        if (n==1){
            System.out.println(priorityQueue.peek()-k*x);
            return;
        }
        while (k>0){
            Integer poll = priorityQueue.poll();
            int gap=0;
            Integer peek = priorityQueue.peek();
            int cha=poll-peek;
            if (cha==0){
                gap=1;
            }else {
                if (cha % x == 0) {
                    int zz = cha / x;
                    if (k >= zz)
                        gap = zz;
                    else
                        gap = k;
                } else {
                    int zz = cha / x + 1;
                    if (k >= zz)
                        gap = zz;
                    else
                        gap = k;
                }
            }
            poll-=gap*x;
            priorityQueue.offer(poll);
            k-=gap;
        }
        System.out.println(priorityQueue.peek());
    }
 */

/*
public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        //数组长度
        int n = scanner.nextInt();
        //操作次数
        int k = scanner.nextInt();
        //减去的数
        int x = scanner.nextInt();
        PriorityQueue<Integer> priorityQueue=new PriorityQueue<>((a,b)->{
            return b-a;
        });
        for (int i=0;i<n;i++){
            priorityQueue.add(scanner.nextInt());
        }
        if (n==1){
            System.out.println(priorityQueue.peek()-k*x);
            return;
        }
        while (k>0){
             Integer poll = priorityQueue.poll();
            int gap=0;
            Integer peek = priorityQueue.peek();
            while (poll>=peek){
                poll-=x;
                gap++;
            }
            priorityQueue.offer(poll);
            k-=gap;
        }
        System.out.println(priorityQueue.peek());
    }
 */
